Generally, bump and texture mapping are rendering processes where basic contours of an object are expressed as graphics primitives (generally, polygons) with various types of data mapped onto graphics primitives. During the course of bump and texture mapping, a color calculation is performed to incorporate colors onto an object in display coordinate space. This object with the colors is then displayed on a display device.
Prior Art FIG. 1 illustrates the method by which an exemplary bump mapping process is accomplished. As shown, a primitive, i.e. polygon, triangle, etc., is first received with pixel data, as shown in operation 100. Included with such pixel data are normal values and possibly other values associated with the vertices associated with the polygon. These vectors are perspectively and correctly interpolated across the primitive. At each pixel, texture coordinates (also interpolated) are used to look up bump mapping information.
During bump mapping, the aforementioned normal values are modified based on a bump map algorithm using the bump mapping information, as indicated in operation 102 of FIG. 1. In particular, the normal's direction is perturbed as though the surface has been displaced a small amount in the direction of the interpolated normals of the primitive. FIG. 2 illustrates a primitive 200 with a normal 202 that is modified to generate a perturbed normal 204. A bumpy surface is thereby simulated.
Thereafter, lighting operations such as shading or the like are performed on the pixel data using the perturbed normal values instead of the original normal values, as indicated in operation 104. This method gives the appearance of bumps and depressions in the surface. Also at this time, the color calculation may be carried out in order to enhance the color of the pixel.
The foregoing bump and texture mapping processes are often supported by graphics application program interfaces (API's). In one embodiment, such interface may include the Open Graphics Library (OpenGL®). OpenGL® is one of the computer industry's standard application program interfaces (APIs) for defining 2-D and 3-D graphic images. An application can create the same effects in any operating system using any OpenGL®-adhering graphics adapter, provided the adapter supports the appropriate version of OpenGL® along with any utilized OpenGL® extensions. OpenGL® specifies a set of commands or immediately executed functions. Typically, a command directs a drawing action or causes special effects (e.g. bump and texture mapping processes).
Another API includes DirectX®. Such API is provided by Microsoft® and is integral to the Windows® operating system. DirectX8® includes a “pixel shaders” functionality. DirectX's® “pixel shaders” perform two particular tasks.
In a typical graphics pipeline, there is the task of interpolating texture coordinates and applying the texture mapping. This per-fragment task maps from interpolated floating-point texture coordinate sets to (typically fixed-point) texture unit RGBA results. In conventional OpenGL®, this mapping is performed by accessing the highest priority enabled texture target using the fragment's corresponding interpolated texture coordinate set. Unfortunately, this mapping is not very powerful.
Second, there is the task of fragment coloring. Fragment coloring is process of combining (typically fixed-point) RGBA colors to generate a final fragment color that, assuming the fragment is not discarded by subsequent per-fragment tests, is used to update the fragment's corresponding pixel in the frame buffer. In conventional OpenGL®, fragment coloring is performed by the enabled texture environment functions, fog, and color sum operations. NVIDIA's® register combiners functionality (See the NV_register_combiners and NV_register_combiners2 extensions, which are incorporated herein by reference) provides a substantially more powerful alternative to conventional OpenGL® fragment coloring.
DirectX8® has two types of opcodes for pixel shaders. Texture address opcodes correspond to the first task listed above. Texture register opcodes correspond to the second task listed above.
While the foregoing bump and texture mapping techniques feature the unevenness of a surface and enhance the color of a pixel, they do not work well to reflect any unevenness in shadows cast by or onto the bumpy surface. Further, there are also limitations as to the interaction of geometric objects. These drawbacks are mainly due to the fact that conventional bump and texture mapping processes have no impact on the z-value of the pixel.
There is thus a need for a texture/bump mapping scheme during graphic processing that overcomes these drawbacks for providing a more realistic rendered image.